import pymysql
import threading
bd=pymysql.connect(host="localhost", user="root", password="zs233", database="py_sql_jianzhimao")
cursor=bd.cursor()
lock=threading.RLock()
def chuangjianbiao(sql):
    cursor.execute(sql)
def gengxinbiao(sql):
    try:
        lock.acquire()
        cursor.execute(sql)
        bd.commit()
        lock.release()
    except Exception as e:
        print(e)
        bd.rollback()